home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg4.cab / test_rotor.py < prev    next >
Text File  |  2005-11-19  |  599b  |  35 lines

  1. import warnings
  2.  
  3. warnings.filterwarnings("ignore",
  4.                         category=DeprecationWarning,
  5.                         message='.*is deprecated', module=__name__)
  6.  
  7. import rotor
  8.  
  9. r = rotor.newrotor("you'll never guess this")
  10. r = rotor.newrotor("you'll never guess this", 12)
  11.  
  12. A = 'spam and eggs'
  13. B = 'cheese shop'
  14.  
  15. a = r.encrypt(A)
  16. print `a`
  17. b = r.encryptmore(B)
  18. print `b`
  19.  
  20. A1 = r.decrypt(a)
  21. print A1
  22. if A1 != A:
  23.     print 'decrypt failed'
  24.  
  25. B1 = r.decryptmore(b)
  26. print B1
  27. if B1 != B:
  28.     print 'decryptmore failed'
  29.  
  30. try:
  31.     r.setkey()
  32. except TypeError:
  33.     pass
  34. r.setkey('you guessed it!')
  35.